import store from '../store'
import axios from 'axios'
import { removeToken } from '@/utils/auth' // getToken from cookie
// 创建axios实例
const service = axios.create({
  timeout: 5000, // 请求超时时间
  withCredentials: false,
})
// request拦截器
service.interceptors.request.use(
  config => {
    // let data = config.data
    console.log("拦截到了")
    // console.log(store.getters.token)
    // config.headers['Authorization'] = store.getters.token
    // config.headers['Content-Type'] = `application/json;charset=UTF-8`;
    // config.data = data
    return config
  },
  error => {
    console.log(error) // for debug
    Promise.reject(error)
  }
)
export default service